/*
 * @Descripttion:
 * @Author: voanit
 * @Date: 2022-05-03 16:13:14
 * @LastEditors: voanit
 * @LastEditTime: 2022-05-08 11:17:41
 */
import React from 'react'
// import * as obj from 'react-router-dom'
/* 
BrowserRouter=====history
HashRouter=======hash
*/
import {
  BrowserRouter as Router,
  Route,
  Link,
  NavLink,
  Switch,
  Redirect,
} from 'react-router-dom'
import Router01 from './views/Router/Router01'
import Home from './views/Router/pages/Home'
import My from './views/Router/pages/My'
import Friend from './views/Router/pages/Friend'
import Func from './views/Router/pages/Func'
import './App.css'
// console.log(obj) //  HashRouter

class App extends React.Component {
  state = {
    val: 'hello  world',
  }
  render() {
    // console.log(obj, 99)
    return (
      <Router>
        <div>
          我是一个类组件
          {/* Link=>相当于router-link */}
          <NavLink to="/home/qq">页面一</NavLink>
          ====
          <NavLink to="/my">页面二</NavLink>
          {/* // 在哪里写的Route,最终匹配到的组件就会渲染到这 */}
          {/* Route==>router-view   集成了router-view和路由匹配规则 */}
          <Switch>
            {/* <Route exact path="/" component={Friend}></Route> */}
            <Route exact path="/home/qq" component={Home}></Route>
            <Route path="/my" component={My}></Route>
            <Redirect from="/" to="/aa"></Redirect>
            {/* 设置404页面 */}
            <Route component={Func} />
          </Switch>
        </div>
      </Router>
    )
  }
}

/* 
{
  path:'/',
  redirect:'/aa'
}


*/

export default App
